<?php 
session_start();
 require_once("include/authen.php");
require_once("include/ui.php");

if ($_SESSION["permission"][$receiveScreen]["View"]=="0"){
	 echo "<script>alert('".$no_permit."');</script>";
	 echo "<meta http-equiv = refresh ; content = '0 ; url = mainscreen.php'>";
	 exit();
}
// show header
echo headerPage("Receive Product");
?>
<SCRIPT src="js/js_receive.js"></SCRIPT> 
 <script>
$(function() {

	$( "#txtDateFrom" ).datepicker({ dateFormat: 'dd/mm/yy',
		showOn: "button",
		changeMonth: true,
		changeYear: true,
		yearRange:'c-10:c+1',		
		buttonImage: "images/Calendar.png",
		buttonImageOnly: true });
				
	$( "#txtDateTo" ).datepicker({ dateFormat: 'dd/mm/yy',
		showOn: "button",
		showOn: "button",
		changeMonth: true,
		changeYear: true,
		yearRange:'c-10:c+1',			
		buttonImage: "images/Calendar.png",
		buttonImageOnly: true });
	
	$("#btnPrint").live('click',function(){
		$("#normal-screen").hide();
		$("#page-header").hide();
		$("#searchdata").hide();
		$(".toolbar-box").hide();
		$("#foolter_table").hide();
		$("#leftboder").hide();
		$("#rightboder").hide();
		window.print();
		
		$("#normal-screen").show();
		$("#page-header").show();
		$("#searchdata").show();
		$(".toolbar-box").show();
		$("#foolter_table").show();
		$("#leftboder").show();
		$("#rightboder").show();
	});			
});
</script>

<FORM id="Act" action="receive_d.php" method="post"> 
<INPUT type=hidden value="add" id="mode" name="mode"> 
<INPUT type=hidden value="" id="reID" name="reID"> 
<INPUT type=hidden value="" id="type" name="type"> 

<table width="1024" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="10" id='leftboder' style='border-left:2px solid #facb0c;'>&nbsp;</td>
    <td width="1004" valign="top">
        <div class="content-box">
            <div Class="toolbar-box">   
                <div class="t">
                    <div class="t">
                        <div class="t"></div>
                    </div>
                 </div>
                 <div class="m">
                    <div class="toolbar">
                        <table class="toolbar">
                        <tr>
                            <td>
								<?php if ($_SESSION["permission"][$receiveScreen]["Add"]=="1"){?>
								<a href="javascript:void('0');" id="btnAdd">
								<span class="icon_add"></span>Add
								</a>
								<?php }?>
							</td>
								<td>
								<a href="javascript:void('0');" title="Print" id="btnPrint">
								<span class="icon_Print"></span>Print
								</a>
							</td>
                        </tr>
                        </table>
                    </div>
                      <div class="header" style="background-image: url(images/receive_2.png);">
						HO Receive Product
                      </div>
                <div class="clr"></div>
                 </div>
                 <div class="b">
                    <div class="b">
                        <div class="b"></div>
                    </div>
                 </div>
            </div>
               <div id="element-box">
                <div class="t">
					<div class="t">
						<div class="t"></div>
					</div>
				</div>
                <div class="m">
                    <table width="100%" id='searchdata'>
                        <tr>
                            <td width="15%" class="fontSearch" style="padding-left:20">
                            Received Code : 
                            </td>
							<td width="85%" align=left >
							<input id="txtReceived_s"  title="Filter by Code "  type="text"  	size=40 name="code" class="boxItem" />
							</td>
                         </tr>
                        <tr>
                            <td width="15%" class="fontSearch" style="padding-left:20">
                            Supplier Name : 
                            </td>
							<td width="85%" align=left >
							 <select id="cboSupplier" style="width:13em;"></select>
							</td>
                         </tr>
                        <tr>
                            <td width="15%" class="fontSearch" style="padding-left:20">
                            Received Date : 
                            </td>
							<td width="85%" align=left >
								<input id="txtDateFrom"  title="Filter by Received Date " type="text" size=10 name="txtDateFrom" class="boxItem" />
								&nbsp;- <input id="txtDateTo"  title="Filter by Received Date " type="text" size=10 name="txtDateTo" class="boxItem" />
							 
							</td>
                        </tr>	
                       <tr>
                            <td width="15%" class="fontSearch" style="padding-left:20">
                            Status : 
                            </td>
							<td width="85%" align=left >
							<select id="cboStatus" style="width:10em;">
							<option value="2" selected>All</option>
							<option value="0">Check</option>
							<option value="1">Closed</option>
							</select>
							</td>
                         </tr>						 
						<tr>
							<td>
							</td>
							<td style="color:#999;display:block;" width="98%">
								<table width="100%" cellspacing="0" cellpadding="0" border="0"  >
								<tr>
									<td>
										<span align="left" width="50%">
										<a href="javascript:void('0');" id="btnSearch"><img src="./images/btn-search.gif" border=0/></a> 
										</span>
									</td>
									<td align='right'>
										<span align="right" width="50%">
											<img src='images/view.png'   title='View' border='0' width="16" height="16"/> : View product  detail
											<img src='images/receive.png' style="padding-left:10px"  title='Confirm receive product' border='0' width="16" height="16" />  :  Confirm receive product 
										</span>
									</td>
								</tr>
								</table>
							</td>
						</tr>
						 <tr>
							<td colspan="2">
						 </tr>
                    </table>
                    <table cellspacing="1" id="resultData" class=list>
                    <thead>
                       <tr>
								<th width="4%">#</th>
								<th style="display:none">id</th>
								<th class="title" width="10%" >Code</th>
								<th class="title" width="25%">Supplier Name</th>
								<th  class="title" width="15%" nowrap="nowrap">Received Date</th>
								<th  class="title" width="10%" nowrap="nowrap">Credit Terms</th>
								<th  class="title" width="10%" nowrap="nowrap">Status</th>
								<!--th  class="title" width="10%" nowrap="nowrap">Amount</th-->
								<th  class="title" width="11%" nowrap="nowrap">Total Price</th>
								<th  class="title" width="5%" nowrap="nowrap">Action</th>
								<!--th  class="title" width="5%" nowrap="nowrap">View</th-->
								<th  class="title" width="5%" nowrap="nowrap">Edit</th>
								<th  class="title" width="5%" nowrap="nowrap">Del</th>
                      </tr>
                    </thead>
                   <tbody>
                     </tbody>
                     <tfoot>
                         <tr>
                            <td colspan="11">
								<div class="boxfooter">
								 <div class="totalpage">Total : <span id="rowCount">0</span>&nbsp;&nbsp;rows</div>
								 <div id="paging_button"> 
								 </div>
							</div>
                         </tr>
                     </tfoot>
                    </table>
                  <div class="clr"></div>
                </div>
                 <div class="b"><div class="b"><div class="b"></div></div></div>
                 <div class="clr"></div>
                </div> <!-- elementbox-->
        </div>
    </td>
    <td width="10" id='rightboder'  style="border-right:2px solid #facb0c;">&nbsp;</td>
  </tr>
</table>
 </FORM>
 <div id="dialog-confirm" title="Confirm delete?" style="padding-top:20px;">
	<p style="font-size:13px"><span class="ui-icon ui-icon-alert" 
		style="float:left; margin:0 7px 20px 0;">
		</span>Are you sure this receive code?</p>
</div>
<div id="dialog-form" >
<p class="validateTips">* fields are required.</p>
 
	<table cellpadding="3" cellspacing="0" border="0" width="100%" class="fieldset">
		<tr>
			<td width="18%"><label for="name" >Receive Code *</label></td>
			<td width="22%"><input type="text" name="Code"  id="Code" class="text ui-widget-content ui-corner-all" /></td>
			<td width="18%"><label for="name" >Supplier Name * </label></td>
			<td width="42%"><select name="SupplierName" id="SupplierName"  style="width:17em;font-size:12px;"/></td>
		</tr>
		<tr>
			<td colspan="4" style="padding-top:10px;">
				<fieldset  class="ui-widget ui-widget-content">
					<legend><label id="lblGroup">Please select Product</label></legend>
					<div class="ui-widget" style="font-size:12px;height:30px;padding-top:15px;">
							<label><span id="lblTitle">&nbsp;&nbsp;Product: </span>&nbsp;&nbsp;&nbsp;
								<select name="productlist" id="productlist" style="width:30em;padding:5px;font-size:12px;">
								</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								Amount : &nbsp;&nbsp;&nbsp;
								<input type="text" name="Amount" style="width:10%;padding:5px;font-size:12px;" maxlength=6  id="Amount" class="ui-widget-content ui-corner-all" />
								&nbsp;&nbsp;&nbsp;Price :&nbsp;&nbsp;&nbsp;
								<input type="text" name="Price" style="width:10%;padding:5px;font-size:12px;"  maxlength=6  id="Price" class="ui-widget-content ui-corner-all" />
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button id="btnAddProduct" style="font-size:12px">Add</button>
							</label>
					</div>
					<table id="tbNewProduct" cellspacing="1" width="100%" cellpadding="3" border="0" style="background-color:#f9f9f9;font-size:12px;border:1px solid #EAEAEA;">
					<thead>
						<tr style="background-color:#CCC;font-weight:bold;">
							<th width="7%">id</th>
							<th width="28%">Product Name</th>
							<th width="15%">Unit</th>
							<th width="15%">Amount</th>
							<th width="15%">Price</th>
							<th width="15%">Total</th>
							<th width="5%">Del</th>
						</tr>
					</thead>
					<tbody style="font-weight:normal;background-color:#fff">
					</tbody>
					<tfoot>
						<tr>
							<td colspan="4" align="left" style="font-size:11px;font-weight:bold;">Count : <span id='iCount' style="color:red">0</span></td>
							<td colspan="3" align="right" style="font-size:11px;font-weight:bold;">Total : <span id='iTotal' style="color:red">0</span></td>
						</tr>
					</tfoot>
					</table>
				</fieldset>
			</td>
		</tr>
	</table>
 
</div>

<?php echo footer();?>